(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[      8366,        268]
NotebookOptionsPosition[      7003,        232]
NotebookOutlinePosition[      7495,        252]
CellTagsIndexPosition[      7452,        249]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[TextData[{
 "I ",
 StyleBox["Mathematica",
  FontSlant->"Italic"],
 " Code for the Proof of Equation E.2"
}], "Section",
 CellChangeTimes->{{3.7094386463653193`*^9, 3.7094386668057146`*^9}, 
   3.719167894665057*^9},ExpressionUUID->"6ced2963-a4f2-472f-bbe1-\
bf94d34f5d53"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"A", "[", 
   RowBox[{"d_", ",", "\[Sigma]2_"}], "]"}], "=", 
  FractionBox[
   RowBox[{"(", 
    RowBox[{
     FractionBox[
      RowBox[{"d", "*", 
       RowBox[{"Exp", "[", 
        RowBox[{"-", 
         FractionBox[
          RowBox[{"d", "^", "2"}], "\[Sigma]2"]}], "]"}]}], 
      RowBox[{"2", "*", "\[Pi]", "*", "\[Sigma]2"}]], "-", 
     FractionBox[
      RowBox[{"Erf", "[", 
       FractionBox["d", 
        RowBox[{"Sqrt", "[", "\[Sigma]2", "]"}]], "]"}], 
      RowBox[{"4", "*", 
       RowBox[{"Sqrt", "[", 
        RowBox[{"\[Pi]", "*", "\[Sigma]2"}], "]"}]}]]}], ")"}], 
   RowBox[{
    RowBox[{"(", 
     RowBox[{"Erf", "[", 
      FractionBox["d", 
       RowBox[{"Sqrt", "[", 
        RowBox[{"2", "*", "\[Sigma]2"}], "]"}]], "]"}], ")"}], "^", 
    "2"}]]}]], "Input",
 CellChangeTimes->{{3.709438670187331*^9, 3.709438780442314*^9}},
 CellLabel->"In[5]:=",ExpressionUUID->"861804ce-d791-4fb0-919e-107a7e5118d0"],

Cell[BoxData[
 FractionBox[
  RowBox[{
   FractionBox[
    RowBox[{"d", " ", 
     SuperscriptBox["\[ExponentialE]", 
      RowBox[{"-", 
       FractionBox[
        SuperscriptBox["d", "2"], "\[Sigma]2"]}]]}], 
    RowBox[{"2", " ", "\[Pi]", " ", "\[Sigma]2"}]], "-", 
   FractionBox[
    RowBox[{"Erf", "[", 
     FractionBox["d", 
      SqrtBox["\[Sigma]2"]], "]"}], 
    RowBox[{"4", " ", 
     SqrtBox["\[Pi]"], " ", 
     SqrtBox["\[Sigma]2"]}]]}], 
  SuperscriptBox[
   RowBox[{"Erf", "[", 
    FractionBox["d", 
     RowBox[{
      SqrtBox["2"], " ", 
      SqrtBox["\[Sigma]2"]}]], "]"}], "2"]]], "Output",
 CellChangeTimes->{3.7094387811088314`*^9, 3.7191678881250772`*^9, 
  3.745735203891342*^9, 3.7457353749508905`*^9},
 CellLabel->"Out[5]=",ExpressionUUID->"60fb310e-299f-4c95-bdda-e513dc515a34"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"dA", "[", 
   RowBox[{"d_", ",", "\[Sigma]2_"}], "]"}], "=", 
  RowBox[{"D", "[", 
   RowBox[{
    RowBox[{"A", "[", 
     RowBox[{"d", ",", "\[Sigma]2"}], "]"}], ",", "\[Sigma]2"}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.7094387883730974`*^9, 3.709438806923767*^9}},
 CellLabel->"In[6]:=",ExpressionUUID->"d0306ef2-e2cc-4028-a09e-ed203f5e90a3"],

Cell[BoxData[
 RowBox[{
  FractionBox[
   RowBox[{"d", " ", 
    SuperscriptBox["\[ExponentialE]", 
     RowBox[{"-", 
      FractionBox[
       SuperscriptBox["d", "2"], 
       RowBox[{"2", " ", "\[Sigma]2"}]]}]], " ", 
    SqrtBox[
     FractionBox["2", "\[Pi]"]], " ", 
    RowBox[{"(", 
     RowBox[{
      FractionBox[
       RowBox[{"d", " ", 
        SuperscriptBox["\[ExponentialE]", 
         RowBox[{"-", 
          FractionBox[
           SuperscriptBox["d", "2"], "\[Sigma]2"]}]]}], 
       RowBox[{"2", " ", "\[Pi]", " ", "\[Sigma]2"}]], "-", 
      FractionBox[
       RowBox[{"Erf", "[", 
        FractionBox["d", 
         SqrtBox["\[Sigma]2"]], "]"}], 
       RowBox[{"4", " ", 
        SqrtBox["\[Pi]"], " ", 
        SqrtBox["\[Sigma]2"]}]]}], ")"}]}], 
   RowBox[{
    SuperscriptBox["\[Sigma]2", 
     RowBox[{"3", "/", "2"}]], " ", 
    SuperscriptBox[
     RowBox[{"Erf", "[", 
      FractionBox["d", 
       RowBox[{
        SqrtBox["2"], " ", 
        SqrtBox["\[Sigma]2"]}]], "]"}], "3"]}]], "+", 
  FractionBox[
   RowBox[{
    FractionBox[
     RowBox[{
      SuperscriptBox["d", "3"], " ", 
      SuperscriptBox["\[ExponentialE]", 
       RowBox[{"-", 
        FractionBox[
         SuperscriptBox["d", "2"], "\[Sigma]2"]}]]}], 
     RowBox[{"2", " ", "\[Pi]", " ", 
      SuperscriptBox["\[Sigma]2", "3"]}]], "-", 
    FractionBox[
     RowBox[{"d", " ", 
      SuperscriptBox["\[ExponentialE]", 
       RowBox[{"-", 
        FractionBox[
         SuperscriptBox["d", "2"], "\[Sigma]2"]}]]}], 
     RowBox[{"4", " ", "\[Pi]", " ", 
      SuperscriptBox["\[Sigma]2", "2"]}]], "+", 
    FractionBox[
     RowBox[{"Erf", "[", 
      FractionBox["d", 
       SqrtBox["\[Sigma]2"]], "]"}], 
     RowBox[{"8", " ", 
      SqrtBox["\[Pi]"], " ", 
      SuperscriptBox["\[Sigma]2", 
       RowBox[{"3", "/", "2"}]]}]]}], 
   SuperscriptBox[
    RowBox[{"Erf", "[", 
     FractionBox["d", 
      RowBox[{
       SqrtBox["2"], " ", 
       SqrtBox["\[Sigma]2"]}]], "]"}], "2"]]}]], "Output",
 CellChangeTimes->{3.7094388075679936`*^9, 3.7191678882382517`*^9, 
  3.7457352040618677`*^9, 3.7457353750467587`*^9},
 CellLabel->"Out[6]=",ExpressionUUID->"ec89f2e1-7587-4dae-89e5-cfd85d745d88"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"assumptions", "=", 
  RowBox[{
   RowBox[{"d", ">", "0"}], "&&", 
   RowBox[{"\[Sigma]2", ">", "0"}]}]}]], "Input",
 CellChangeTimes->{{3.709438813727248*^9, 3.7094388222933035`*^9}},
 CellLabel->"In[7]:=",ExpressionUUID->"8d0e7ae2-089e-4b3b-9357-2fc19e5a015d"],

Cell[BoxData[
 RowBox[{
  RowBox[{"d", ">", "0"}], "&&", 
  RowBox[{"\[Sigma]2", ">", "0"}]}]], "Output",
 CellChangeTimes->{3.7094388226665173`*^9, 3.719167888243772*^9, 
  3.7457352040774975`*^9, 3.745735375062385*^9},
 CellLabel->"Out[7]=",ExpressionUUID->"1d63bec8-71d3-468d-99b0-1cd6cfde4f5e"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"NMinimize", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"dA", "[", 
      RowBox[{"d", ",", "\[Sigma]2"}], "]"}], ",", "assumptions"}], "}"}], 
   ",", 
   RowBox[{"{", 
    RowBox[{"d", ",", "\[Sigma]2"}], "}"}], ",", " ", 
   RowBox[{"MaxIterations", "\[Rule]", "100"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.70943882512372*^9, 3.7094388463418455`*^9}, {
  3.745735364946455*^9, 3.745735389818112*^9}},
 CellLabel->"In[10]:=",ExpressionUUID->"d98819a6-ac24-4ec0-8821-6183ac373401"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"5.760581428489493`*^-58", ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"d", "\[Rule]", "1.4349721678853395`*^23"}], ",", 
     RowBox[{"\[Sigma]2", "\[Rule]", "2.465542564427336`*^37"}]}], "}"}]}], 
  "}"}]], "Output",
 CellChangeTimes->{
  3.7094388482228794`*^9, 3.719167890627489*^9, 3.7457352064049473`*^9, {
   3.745735375428125*^9, 3.7457353905992346`*^9}},
 CellLabel->"Out[10]=",ExpressionUUID->"8d569db6-ea97-4c8a-9fde-9bb2f2b60d8b"]
}, Open  ]]
}, Open  ]]
},
WindowSize->{958, 988},
WindowMargins->{{Automatic, -7}, {Automatic, 0}},
PrintingCopies->1,
PrintingPageRange->{32000, 32000},
PrintingOptions->{"Magnification"->1.,
"PaperOrientation"->"Portrait",
"PaperSize"->{612, 792}},
FrontEndVersion->"11.3 for Microsoft Windows (64-bit) (March 6, 2018)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 278, 8, 67, "Section",ExpressionUUID->"6ced2963-a4f2-472f-bbe1-bf94d34f5d53"],
Cell[CellGroupData[{
Cell[883, 34, 969, 29, 109, "Input",ExpressionUUID->"861804ce-d791-4fb0-919e-107a7e5118d0"],
Cell[1855, 65, 810, 25, 109, "Output",ExpressionUUID->"60fb310e-299f-4c95-bdda-e513dc515a34"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2702, 95, 386, 10, 28, "Input",ExpressionUUID->"d0306ef2-e2cc-4028-a09e-ed203f5e90a3"],
Cell[3091, 107, 2209, 71, 122, "Output",ExpressionUUID->"ec89f2e1-7587-4dae-89e5-cfd85d745d88"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5337, 183, 285, 6, 28, "Input",ExpressionUUID->"8d0e7ae2-089e-4b3b-9357-2fc19e5a015d"],
Cell[5625, 191, 298, 6, 32, "Output",ExpressionUUID->"1d63bec8-71d3-468d-99b0-1cd6cfde4f5e"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5960, 202, 526, 13, 28, "Input",ExpressionUUID->"d98819a6-ac24-4ec0-8821-6183ac373401"],
Cell[6489, 217, 486, 11, 36, "Output",ExpressionUUID->"8d569db6-ea97-4c8a-9fde-9bb2f2b60d8b"]
}, Open  ]]
}, Open  ]]
}
]
*)

